home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-19 | 980 b | 58 lines | [TEXT/CWIE] |
-
- class CatInfoChanger: private Task,
- public CInfoPBRec
- {
- private:
- bool getting;
-
- virtual void Launch();
- virtual void Kill();
-
- static void Complete( CInfoPBRec *block );
-
- public:
- CatInfoChanger();
-
- Task *Get( const FSSpec& );
- Task *Set( const FSSpec& );
- };
-
-
- CatInfoChanger::CatInfoChanger()
- {
- hFileInfo.ioCompletion = &CompleteGlue;
- hFileInfo.ioResult = noErr;
- }
-
-
- Task *CatInfoChanger::Get( const FSSpec& location )
- {
- hFileInfo.ioVRefNum = location.vRefNum;
- hFileInfo.ioDirID = location.parID;
- hFileInfo.ioNamePtr = const_cast<StringPtr>( location.name );
- hFileInfo.ioFDirIndex = 0;
- getting = true;
-
- return this;
- }
-
-
- void CatInfoChanger::Launch()
- {
- if ( getting )
- PBGetCatInfoAsync( this );
- else
- PBSetCatInfoAsync( this );
- }
-
- void CatInfoChanger::Kill()
- {
- }
-
- void CatInfoChanger::Complete( CInfoPBRec *block )
- {
- CatInfoChanger *self = static_cast< CatInfoChanger * >( block );
- self->Task::Complete();
- }
-
-